import java.util.HashSet;

//哈希表 存在重复元素I
//https://leetcode.cn/problems/contains-duplicate/
public class Test {
    public static void main(String[] args) {

    }
}


class Solution {
    public boolean containsDuplicate(int[] nums) {
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < nums.length; i++) {
            if (set.contains(nums[i])) {
                return true;
            }
            set.add(nums[i]);
        }
        return false;
    }
}